#!/usr/bin/perl
#lvmount.cgi
require './lvm-lib.pl';
&ReadParse();
my ($err_msg, $lvname, @pvinfo, @vginfo, @lvinfo, $l, $lv, $lock);

$err_msg="";
@pvinfo = get_pv_info();
@vginfo = get_vg_info();
@lvinfo = get_lv_info();
$lvname = $in{'lv'};
if (!$lvname){
	$err_msg="No VG select.";
	goto ERROR_OUT;
}

my $found = 0;
foreach $l (@lvinfo) {
	if ($l->{'lv'} eq $lvname) {
		$lv = $l;
		$found = 1;
		last;
	}
}

if (!$found) {
	$err_msg = $lvname."VG NOT FOUND.";
	goto ERROR_OUT;
}
&header($text{'title_mount'}, "", "", 0, 1);
#goto ERROR_OUT;
print "<form name=mountlv action=act_lvmount.cgi>";
print "<table class=group border=0 cellpadding=4 cellspacing=0 width=100%>\n";
print "<tr><td class=group><table class=mode1 cellpadding=3 cellspacing=0 width=100%>\n";
print "<tr><td width=250><b>$text{'lvname'}</b></td><td>$lv->{'lvname'}</td></tr>\n";
print "<tr><td width=250><b>$text{'index_vg'}</b></td><td>$lv->{'vg'}</td></tr>\n";
print "<tr><td width=250><b>$text{'lvsize'}(MB)</b></td><td>$lv->{'size'}</td></tr>\n";
print "<tr><td width=250><b>$text{'pass1'}</b></td><td>";
print "<input type=password class=text name=lvpass>";
print "</tr>";

print "</table></td></tr>\n";
print "<tr><td><input type=submit class=button1 name=mount value=$text{'bt_lvmount'}></td></tr>";
print "</table>\n";
print "<input type=hidden name=lvname value=$lv->{'lvname'}>";
print "<input type=hidden name=lvvg value=$lv->{'vg'}>";
#print "<input type=hidden name=lvname>";

print "</form>";
&footer("/lvm/", $text{'index'});
return;

print <<EOF;
<script>

</script>
EOF

ERROR_OUT:
&error_setup($text{'crt_err_title'});
&error($err_msg);
